#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2024/9/6 11:11
# @File           : vendor
# @IDE            : PyCharm
# @desc           : 描述

from typing import Optional
from pydantic import BaseModel, ConfigDict
from core.data_types import DatetimeStr


class Plan(BaseModel):
    part_no: str
    part_name: str

    plan_type: Optional[str] = None
    status: Optional[str] = None

    form_no:  Optional[str] = None
    content: Optional[str] = None

    create_user: Optional[str] = None


class PlanUpdate(BaseModel):
    update_user: Optional[str] = None


class PlanCheckRebutIn(Plan):
    plan_type: Optional[str] = "驳回"
    status: Optional[str] = "未处理"


class PlanFemaleMissingIn(Plan):
    plan_type: Optional[str]  = "母本异常"
    content: Optional[str]  = "该零件母本未创建"


class PlanFemaleUpVersionIn(Plan):
    plan_type: Optional[str]  = "升版"
    content: Optional[str]  = "母本升版中"


class PlanSimpleOut(Plan):
    model_config = ConfigDict(from_attributes=True)

    id: int
    update_datetime: DatetimeStr
    create_datetime: DatetimeStr
